﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace einuorg_console
{
    public class Asimov
    {
        public static void Initialize()
        {
            Terminal.Tab(Terminal.TabState.Default);
            Terminal.WriteLine("Basic Operations: ");
            Terminal.EmptyLine();
            Terminal.Brackets("1", Terminal.BracketState.Default);
            Terminal.WriteLine("Multiply");
            Terminal.Brackets("2", Terminal.BracketState.Default);
            Terminal.WriteLine("Divide");
            Terminal.Brackets("3", Terminal.BracketState.Default);
            Terminal.WriteLine("Add");
            Terminal.Brackets("4", Terminal.BracketState.Default);
            Terminal.WriteLine("Subtract");
            Terminal.EmptyLine();
            Terminal.Tab(Terminal.TabState.Default);
            Terminal.WriteLine("Complex operations: ");
            Terminal.EmptyLine();
            Terminal.Brackets("SQ", Terminal.BracketState.Default);
            Terminal.WriteLine("Square");
            Terminal.Brackets("RT", Terminal.BracketState.Default);
            Terminal.WriteLine("Square Root");
            Terminal.EmptyLine();
            Terminal.Tab(Terminal.TabState.Default);
            Terminal.Write("Choose your operation: ");
            
            string choice = Console.ReadLine();
            switch (choice)
            {
                case "1":
                    Multiply();
                    break;

                case "2":
                    Divide();
                    break;

                case "3":
                    Add();
                    break;

                case "4":
                    Subtract();
                    break;
                
                case "SQ":
                    SQ();
                    break;
                
                case "RT":
                    RT();
                    break;
            }
        }

        public static void Multiply()
        {
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("Input number 1: ");
            double Number1 = Convert.ToDouble(Console.ReadLine());
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("Input number 2: ");
            double Number2 = Convert.ToDouble(Console.ReadLine());
            double Number3 = Number1 * Number2;
            Terminal.EmptyLine();
            Terminal.Tab(Terminal.TabState.Success);
            Console.WriteLine("Output number: " + Convert.ToString(Number3));
            Terminal.EmptyLine();
            Terminal.ReadLine();
            Terminal.Clear();
            Initialize();
        }
        public static void Divide()
        {
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("Input number 1: ");
            double Number1 = Convert.ToDouble(Console.ReadLine());
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("Input number 2: ");
            double Number2 = Convert.ToDouble(Console.ReadLine());
            double Number3 = Number1 / Number2;
            Terminal.EmptyLine();
            Terminal.Tab(Terminal.TabState.Success);
            Console.WriteLine("Output number: " + Convert.ToString(Number3));;
            Terminal.EmptyLine();
            Terminal.ReadLine();
            Terminal.Clear();
            Initialize();
        }
        public static void Add()
        {
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("input number 1: ");
            double number1 = Convert.ToDouble(Console.ReadLine());
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("input number 2: ");
            double number2 = Convert.ToDouble(Console.ReadLine());
            double number3 = number2 + number1;
            Terminal.EmptyLine();
            Terminal.Tab(Terminal.TabState.Success);
            Console.WriteLine("Output number: " + Convert.ToString(number3));          
            Terminal.EmptyLine();
            Terminal.ReadLine();
            Terminal.Clear();  
            Initialize();
        }
        public static void Subtract()
        {
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("Input number 1: ");
            double number1 = Convert.ToDouble(Console.ReadLine());
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("Input number 2: ");
            double number2 = Convert.ToDouble(Console.ReadLine());
            Double number3 = number1 - number2;           
            Terminal.EmptyLine();
            Terminal.Tab(Terminal.TabState.Success);
            Console.WriteLine("Output number: " + Convert.ToString(number3));
            Terminal.EmptyLine();
            Terminal.ReadLine();
            Terminal.Clear();
            Initialize();
        }
        public static void SQ()
        {
            Terminal.Tab(Terminal.TabState.Warning);
            Console.Write("Input Number 1: ");
            double Number1 = Convert.ToDouble(Console.ReadLine());            
            Terminal.Tab(Terminal.TabState.Success);
            double Number2 = Number1 * Number1;
            Console.WriteLine("Output number: " + Convert.ToString(Number2));
            Terminal.EmptyLine();
            Terminal.ReadLine();
            Terminal.Clear();
            Initialize();
        }
        public static void RT()
        {
            Terminal.Tab(Terminal.TabState.Warning);
            Terminal.Write("Input number: ");
            double Number1 = Convert.ToDouble(Console.ReadLine());
            Terminal.Tab(Terminal.TabState.Success);
            double Number2 = Math.Sqrt(Number1);
            Terminal.EmptyLine();
            Terminal.Tab(Terminal.TabState.Success);
            Console.WriteLine("Output number: " + Convert.ToString(Number2));
            Terminal.EmptyLine();
            Terminal.ReadLine();
            Terminal.Clear();
            Initialize();

        }
    }
}
